@using Microsoft.AspNetCore.Mvc.Localization
@model Skoruba.IdentityServer4.Admin.BusinessLogic.Identity.Dtos.Identity.Interfaces.IUserDto
@inject IViewLocalizer Localizer

@{
    ViewBag.Title = Localizer["PageTitle"];
    Layout = "_Layout";
}

<div class="row">
    <div class="col-12">
        <nav aria-label="breadcrumb">
            <ol class="breadcrumb">
                <li class="breadcrumb-item"><a asp-controller="Identity" asp-action="Users">@Localizer["NavigationUsers"]</a></li>
                <li class="breadcrumb-item active" aria-current="page">@Model.UserName</li>
            </ol>
        </nav>
    </div>

    <div class="col-12">
        <h2>@Localizer["PageTitle"]</h2>
    </div>
</div>

<form id="client-form" asp-controller="Identity" asp-action="UserProfile" Method="post">

    <div asp-validation-summary="All" class="text-danger"></div>

    @if (!Model.IsDefaultId())
    {
        <!--Button-->
        <div class="form-group row">
            <div class="col-md-12 col-m-b-10  col-m-t-10">
                <a asp-action="UserClaims" asp-route-id="@Model.Id" class="btn btn-outline-primary">@Localizer["ButtonManageUserClaims"]</a>
                <a asp-action="UserRoles" asp-route-id="@Model.Id" class="btn btn-outline-primary">@Localizer["ButtonManageUserRoles"]</a>
                <a asp-action="UserProviders" asp-route-id="@Model.Id" class="btn btn-outline-primary">@Localizer["ButtonManageUserExternalProviders"]</a>
                <a asp-action="AuditLog" asp-controller="Log" asp-route-subjectIdentifier="@Model.Id" class="btn btn-primary">@Localizer["Audit Log"]</a>
                <a asp-action="UserChangePassword" asp-route-id="@Model.Id" class="btn btn-dark">@Localizer["ButtonChangePassword"]</a>
                <a asp-action="UserDelete" asp-route-id="@Model.Id" class="btn btn-danger">@Localizer["ButtonDeleteUser"]</a>
            </div>
        </div>
    }

    <!--Hidden -->
    <input type="hidden" asp-for="Id" />

    <div class="card mt-3">
        <h5 class="card-header">@Localizer["PanelTitle"]</h5>
        <div class="card-body">

            <div class="row">
                <div class="col-lg-2 mb-3">
                    <img-gravatar email="@Model.Email" class="img-thumbnail" size="150" />
                </div>
                <div class="col-sm-10">
                    <!--Input - text -->
                    <div class="form-group row">
                        <label asp-for="UserName" class="col-sm-3 col-form-label">
                            @await Html.PartialAsync("User/Section/Label", "UserUserName")
                        </label>
                        <div class="col-sm-9">
                            <input type="text" required class="form-control" asp-for="UserName">
                            <span asp-validation-for="UserName" class="text-danger"></span>
                        </div>
                    </div>

                    <!--Input - text -->
                    <div class="form-group row">
                        <label asp-for="Email" class="col-sm-3 col-form-label">
                            @await Html.PartialAsync("User/Section/Label", "UserEmail")
                        </label>
                        <div class="col-sm-9">
                            <input type="email" required class="form-control" asp-for="Email">
                            <span asp-validation-for="Email" class="text-danger"></span>
                        </div>
                    </div>

                    <!--Checkbox-->
                    <div class="form-group row">
                        <label asp-for="EmailConfirmed" class="col-sm-3 col-form-label">
                            @await Html.PartialAsync("User/Section/Label", "UserEmailConfirmed")
                        </label>
                        <div class="col-sm-9">
                            <toggle-button>
                                <input asp-for="EmailConfirmed" type="checkbox">
                            </toggle-button>
                        </div>
                    </div>

                    <!--Input - text -->
                    <div class="form-group row">
                        <label asp-for="PhoneNumber" class="col-sm-3 col-form-label">
                            @await Html.PartialAsync("User/Section/Label", "UserPhoneNumber")
                        </label>
                        <div class="col-sm-9">
                            <input type="text" class="form-control" asp-for="PhoneNumber">
                        </div>
                    </div>

                    <!--Checkbox-->
                    <div class="form-group row">
                        <label asp-for="PhoneNumberConfirmed" class="col-sm-3 col-form-label">
                            @await Html.PartialAsync("User/Section/Label", "UserPhoneNumberConfirmed")
                        </label>
                        <div class="col-sm-9">
                            <toggle-button>
                                <input asp-for="PhoneNumberConfirmed" type="checkbox">
                            </toggle-button>
                        </div>
                    </div>

                    <!--Checkbox-->
                    <div class="form-group row">
                        <label asp-for="LockoutEnabled" class="col-sm-3 col-form-label">
                            @await Html.PartialAsync("User/Section/Label", "UserLockoutEnabled")
                        </label>
                        <div class="col-sm-9">
                            <toggle-button>
                                <input asp-for="LockoutEnabled" type="checkbox">
                            </toggle-button>
                        </div>
                    </div>

                    <!--Checkbox-->
                    <div class="form-group row">
                        <label asp-for="TwoFactorEnabled" class="col-sm-3 col-form-label">
                            @await Html.PartialAsync("User/Section/Label", "UserTwoFactorEnabled")
                        </label>
                        <div class="col-sm-9">
                            <toggle-button>
                                <input asp-for="TwoFactorEnabled" type="checkbox">
                            </toggle-button>
                        </div>
                    </div>

                    <!--Input - text -->
                    <div class="form-group row">
                        <label asp-for="AccessFailedCount" class="col-sm-3 col-form-label">
                            @await Html.PartialAsync("User/Section/Label", "UserAccessFailedCount")
                        </label>
                        <div class="col-sm-9">
                            <input type="text" class="form-control" asp-for="AccessFailedCount">
                        </div>
                    </div>

                    <!--Input - text -->
                    <div class="form-group row">
                        <label asp-for="LockoutEnd" class="col-sm-3 col-form-label">
                            @await Html.PartialAsync("User/Section/Label", "UserLockoutEnd")
                        </label>
                        <div class="col-sm-9">
                            <div class="input-group date" id="logoutend-picker" data-target-input="nearest">
                                <input asp-for="LockoutEnd" type="text" class="form-control">
                                <div class="input-group-append" data-target="#logoutend-picker" data-toggle="datetimepicker">
                                    <div class="input-group-text"><i class="fa fa-calendar"></i></div>
                                </div>
                            </div>
                        </div>
                    </div>

                    <!--Button-->
                    <div class="form-group row">
                        <label class="col-sm-3 col-form-label">
                        </label>
                        <div class="col-sm-9">
                            <button type="submit" class="btn btn-primary">@Localizer["ButtonSaveUser"]</button>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</form>

@section scripts
    {
    <script type="text/javascript">
        $(function () {
            $('#logoutend-picker').datetimepicker();
        });
    </script>
}





